<?php
require_once('css.php');

$styleClassA = new StyleClass('.classA');
$styleClassA ->addStyle('position','absolute');
$styleClassA ->addStyle('  top :  10px ');
$styleClassA ->addStyle('  left :  20px;');
$styleClassA ->addStyle('  width :  100px  ;  /* this is a comment  ');
$styleClassA ->addStyle('left','30px'); //subistituindo um elemento que ja existia
$styleClassA ->addStyle('top : 50px'); //subistituindo um elemento que ja existia
$styleClassA ->addStyle('position', 'relative'); //subistituindo um elemento que ja existia
$styleClassA ->addStyle('margin-left', '2px'); //adicionando elemento
$styleClassA ->addStyle('margin-top', '3px'); //adicionando elemento
$styleClassA->height = '30px';
$styleClassA->backgroundColor = 'red';
$styleClassA ->removeStyle('width');

echo $styleClassA;

//$styleClassB = new StyleClass('.classB', $classA);
//var_dump($styleClassB->getArray());

$styleClassC = new StyleClass('.classC', 'color:blue;   text-align: center  ; text-decoration: none ; ');

echo '</br></br>';

echo $styleClassC;
echo '</br></br>';

$styleClassD = new StyleClass('.classD', array('color'=>'red ', 'text-align'=>'right', 'text-decoration'=>'underline') );

echo $styleClassD;
echo '</br></br>';

$tempArrayE[] = 'border: solid 1px black';
$tempArrayE[] = 'padding: 0';
$tempArrayE[] = 'margin-left: 5px';

$styleClassE = new StyleClass('.classE', $tempArrayE);

echo $styleClassE;
echo '</br></br>';

$styleClassF = new StyleClass('.classF { border: none ; padding: 0; margin-top  : 5px ; text-align:left;}');

echo $styleClassF;
echo '</br></br>';


$styleClassG = new StyleClass('.classG', $styleClassA->__toString(false, false, false, 5, false) );
$styleClassG ->addStyle('position: absolute');

echo $styleClassG;
echo '</br></br>';

$styleClassH = new StyleClass($styleClassA->__toString(true, false, false, 5, false) );
$styleClassH ->setName('.classH');

echo $styleClassH;
echo '</br></br>';

$styleSheetA = new StyleSheet();
$styleSheetA ->addClass($styleClassA->__toString(true, false, false, 5, false));
$styleSheetA ->addClass($styleClassG);
$styleSheetA ->addClass('.classA', 'border: none');
//$styleSheetA ->removeClass('.classG');
//echo $styleSheetA ->getClass('.classG')->getElement('position')->getValue(); //caminho completo
//var_dump($styleSheetA->getArray() );

echo $styleSheetA;
echo '</br></br>';

$styleSheetB = new StyleSheet('
 .classA
 {
     position    : relative;
     top         : 50px;
      left        : 30px;
    margin-left : 2px;
     margin-top  : 3px;
 }

 .classB
  {
  position:relative;
  top:50px;
  left:30px;
  margin-left:2px;
  margin-top:3px;
  }

  .classC{color:blue;text-align:center;text-decoration:none;}

  .classD{color:red;text-align:right;text-decoration:underline;}

  .classE{border : solid 1px black; padding : 0; margin-left : 5px; }

  .classF
  {
      border     : none;
      padding    : 0;
      margin-top : 5px;
      text-align : left;
  }
');

echo $styleSheetB;
echo '</br></br>';

$styleSheetC = new StyleSheet();
$styleSheetC ->loadFromUrl('http://nostaljia.eng.br/trialforcenostaljiaengbr/wp-content/themes/classic/style.css');

echo $styleSheetC;

var_dump($styleSheetC); //show the array of objects converted 

?>